﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Acms.Bll;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    public Acms.AcmsControls.TemplatePage AcmsPage
    {
        get
        {
            return this.Page as Acms.AcmsControls.TemplatePage;
        }
    }

    protected void dsMenu_Select(object sender, Acms.DataControls.EventDrivenDataSourceSelectEventArgs e)
    {
        List<Post> posts = new List<Post>();
        var home = Post.GetTopLevelBySiteId(AcmsPage.AcmsContext.SiteId, AcmsPage.AcmsContext.SiteVersion);
        if (home != null)
        {
            posts.Add(home);
            posts.AddRange(home.Children);
        }
        e.SetData(posts);
    }
}
